<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html; charset=utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>代理管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
    <style>
        thead tr th{text-align: center!important;font-weight: bold!important;}
        tr td{text-align: center!important;}
        .layui-table-cell {
            height: auto;
        }
    </style>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body layui-form">
                    <%-- 查询条件设置 --%>
                    <div class="layui-container layui-form-item" style="padding-bottom: 50px">
                        <div class="layui-col-md12">
                            <div class="layui-col-md3">
                                <div class="layui-col-sm3" style="line-height: 38px">线上名称：</div>
                                <div class="layui-col-sm8">
                                    <input type="text" name="nickNameOn" class="layui-input"  placeholder="商家线上名称" value="${business.nickNameOn}">
                                </div>
                            </div>
                            <div class="layui-col-md3">
                                <div class="layui-col-sm3" style="line-height: 38px">线下名称：</div>
                                <div class="layui-col-sm8">
                                    <input type="text" name="nickName" class="layui-input"  placeholder="商家线下名称" value="${business.nickName}">
                                </div>
                            </div>
                            <div class="layui-col-md3">
                                <div class="layui-col-sm3" style="line-height: 38px">营业执照：</div>
                                <div class="layui-col-sm8">
                                    <input type="text" name="licenseCode" class="layui-input"  placeholder="营业执照号" value="${business.licenseCode}">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md12">&nbsp;</div>
                        <div class="layui-col-md12">
                            <div class="layui-col-md3">
                                <div class="layui-col-sm3" style="line-height: 38px">联系电话：</div>
                                <div class="layui-col-sm8">
                                    <input type="text" name="linkPhone" class="layui-input"  placeholder="商家联系电话" value="${business.linkPhone}">
                                </div>
                            </div>
                            <div class="layui-col-md3">
                                <div class="layui-col-sm3" style="line-height: 38px">行业：</div>
                                <div class="layui-col-sm8">
                                    <select name="industryId">
                                        <option value="">请选择</option>
                                        <c:forEach items="${industryList}" var="sup">
                                            <option value="${sup.id}"  <c:if test='${business.industryId == sup.id}'>selected</c:if>>${sup.name}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-col-md3">
                                <div class="layui-col-sm3" style="line-height: 38px">店铺状态：</div>
                                <div class="layui-col-sm8">
                                    <select name="open">
                                        <option value="">请选择</option>
                                        <option value="0" ${business.open==0?'selected':''}>关闭</option>
                                        <option value="1" ${business.open==1?'selected':''}>正常</option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-col-md3">
                                <div class="layui-col-sm3">
                                    <button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="LAY-app-contlist-search">查询</button>
                                </div>
                            </div>
                        </div>

                    </div>

                    <table class="layui-table" lay-filter="customer-table" id="customer-table"></table>
                    <script type="text/html" id="status">
                        {{# if(d.open == 1){ }}
                        <span class="layui-badge layui-bg-green">正常</span>
                        {{# } else { }}
                        <span class="layui-badge">关店</span>
                        {{# } }}
                    </script>
                    <script type="text/html" id="businessType">
                        {{# if(d.onOff == 0){ }}
                        <span class="layui-badge layui-bg-green">线上</span>
                        {{# } else { }}
                        <span class="layui-badge">线下</span>
                        {{# } }}
                    </script>
                    <script type="text/html" id="index">
                        {{d.LAY_TABLE_INDEX+1}}
                    </script>
                    <script type="text/html" id="nickName">
                        {{# if(d.nickNameOn != null && d.nickNameOn != ''){ }}
                        <span><span style="font-weight: bold">线上：</span>{{d.nickNameOn}}</span><br>
                        {{# } }}
                        {{# if(d.nickName != null && d.nickName != ''){ }}
                        <span><span style="font-weight: bold">线下：</span>{{d.nickName}}</span><br>
                        {{# } }}
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" src="/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form','table'], function(){
        var form = layui.form,table = layui.table,$ = layui.$,admin=layui.admin;

        table.render({
            elem:'.layui-table',
            url:'/data/queryBusiness',
            page:true,
            request:{
                pageName:'current',
                limitName:'size'
            },
            cols:[[
                {field:'index',title:'序号',width:80,templet:"#index"},
                {field:'name',title:'名称',minWidth:120,templet:"#nickName"},
                {field:'addressDetail',title:'地址',minWidth:200},
                {field:'realName',title:'联系人',width:100},
                {field:'phone',title:'联系电话',width:150},
                {field:'industryName',title:'行业分类',width:100},
                {field:'onOff',title:'店铺范围',width:100,templet:"#businessType"},
                {field:'open',title:'店铺状态',width:100,templet:"#status"},

                {field : 'createTime', title : '创建时间', minWidth:150,
                    templet: "<div>{{layui.util.toDateString(d.createTime, 'yyyy-MM-dd HH:mm')}}</div>"
                }
            ]]
        });


        //监听搜索
        form.on('submit(LAY-app-contlist-search)', function(data){
            var field = data.field;
            //执行重载
            table.reload('customer-table', {
                where: field
            });
        });

    });
</script>
</body>
</html>